package com.emm.yixun.common.model.enums;

import java.io.Serializable;
import org.apache.commons.lang.StringUtils;

public enum YiXiangWuYeEnum implements Serializable{
		YIXIANHAIJING("1","一线海景公寓",null),
		HAIJING("2","海景公寓",null),
		DUJIAGONGYU("3","度假公寓",null),
		JIUDIANSHI("4","酒店式公寓",null),
		DUJIABIESHU("5","度假别墅",null),
		GAOERFUBIESHU("6","高尔夫别墅",null),
		YIXIANHAIJINGBIESHU("7","一线海景别墅",null),
		GAOCENGGONGYU("8","高层公寓",null),
		DUOCENGGONGYU("9","多层公寓",null),
		PINGCENGGUANDI("10","平层官邸",null),
		PAIWU("11","排屋",null),
		SHANGPU("12","商铺",null),
		BIESHU("13","别墅",null),
		FASHIPAIWU("14","法式园景排屋",null),
		FASHIHEYUAN("15","法式园景合院",null),
		ZHONGSHIDAZHAI("16","中式大宅",null),
		XIEZILOU("17","写字楼",null),
		VILLA("18","VILLA",null),
		XIAOYUANBIESHU("19","小院别墅",null),
		DUDONGZONGBU("20","独栋总部办公",null),
		YUECENG("21","跃层",null),
		WEIZHI("22","未知",null),
		;
		
		private final String no;
		private final String des;
		private final Enum parent;
		
		/**
		 * 私有构造函数
		 * @param code
		 * @param description
		 */
		YiXiangWuYeEnum(String no, String des,Enum parent) {
			this.no = no;
			this.des = des;
			this.parent = parent;
		}

		/**
		 * @return Returns the no.
		 */
		public String getNo() {
			return no;
		}

		/**
		 * @return Returns the des.
		 */
		public String getDes() {
			return des;
		}
		
		/**
		 * @return Returns the parent.
		 */
		public Enum getParent() {
			return parent;
		}

		/**
		 * 通过枚举<code>des</code>获得枚举
		 * 
		 * @param des
		 * @return
		 */
		public static YiXiangWuYeEnum getByDescription(String des) {
			if(StringUtils.isBlank(des)){
				return null;
			}
			for (YiXiangWuYeEnum menum : values()) {
				if (menum.getDes().equals(des)) {
					return menum;
				}
			}
			return null;
		}
		public static YiXiangWuYeEnum getByNo(String no) {
			if(StringUtils.isBlank(no)){
				return null;
			}
			for (YiXiangWuYeEnum menum : values()) {
				if (menum.getNo().equals(no)) {
					return menum;
				}
			}
			return null;
		}
}
